package cn.itlaobing.web.filter.sitemeshtag;

import org.sitemesh.SiteMeshContext;
import org.sitemesh.content.ContentProperty;
import org.sitemesh.content.tagrules.TagRuleBundle;
import org.sitemesh.content.tagrules.html.ExportTagToContentRule;
import org.sitemesh.tagprocessor.State;

/**
 * 类名: cn.itlaobing.web.filter.sitemeshtag
 * 功能: 自定义sitemesh标签
 * 作者: 王博
 * 日期: 2017/11/13 15:41
 */
public class CssJsTag implements TagRuleBundle {
    @Override
    public void install(State defaultState, ContentProperty contentProperty, SiteMeshContext siteMeshContext) {
        defaultState.addRule("css", new ExportTagToContentRule(siteMeshContext, (ContentProperty)contentProperty.getChild("css"), false));
        defaultState.addRule("js", new ExportTagToContentRule(siteMeshContext, (ContentProperty)contentProperty.getChild("js"), false));
    }

    @Override
    public void cleanUp(State state, ContentProperty contentProperty, SiteMeshContext siteMeshContext) {

    }
}
